<template>
	<view>
		<image src="/static/work1.jpg" mode="" class="img_bg " style="top: 0;"></image>
		<view class="margin-l30 margin-r30">
			<block v-for="(item,index) in list" :key="index">
				<view class="card margin-t30 relative" @tap="toDetail(item.merge_id)">
					<view :class="item.status==1?'jiaobiao':'jiaobiao2'">
						{{item.status==0?'未考完':'已考完'}}
					</view>
					<view class="display justify-between margin-t22">
						<!-- <view class="font-gray1 "></view> -->
						<view class="font-gray1 ">考试名称：</view>
						<view>{{item.exam_name?item.exam_name:"-"}}</view>
					</view>
					<view class="display justify-between margin-t22">
						<view class="font-gray1 ">题目数量</view>
						<view>{{item.exam_count?item.exam_count:"-"}}</view>
					</view>

					<view class="display justify-between margin-t22">
						<view class="font-gray1 text-22">开考时间</view>
						<view class="font-gray1 text-22">{{item.start_time?item.start_time:"-"}}</view>
					</view>

					<view class="display justify-between margin-t22">
						<view class="font-gray1 text-22">结束时间</view>
						<view class="font-gray1 text-22">{{item.end_time?item.end_time:"-"}}</view>
					</view>
				</view>
				
				
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: '',
				token: '',
				loadingText: '',
				list: [],
				weitongguo: '未通过',


			}
		},
		onLoad() {
			this.uid = uni.getStorageSync('user').uid;
			this.token = uni.getStorageSync('user').token;
			this.getExamMessage()
		},
		methods: {
			getExamMessage() {
				var that = this
				var page = 1

				uni.request({
					url: 'https://aqmore.sxpz.vip/AppApi/Exam/index?uid=' + this.uid + '&token=' + this.token +
						'&p=' + page,
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						console.log(res)
						if (res.data.code == 100) {
							console.log(res)
							uni.showToast({
								title: res.data.datas.msg,
								icon: 'none'
							})
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/index/index'
								})
								try {
									uni.removeStorageSync('user');
									console.log('chenggonmg')
								} catch (e) {
									// error
								}
							}, 1500)
						}
						if (res.data.code == 200) {
							that.list = res.data.datas
						}
					}
				})
			},
			toDetail(e){
				uni.navigateTo({
					url:'./examDetail?merge_id='+e
				})
			}
		}
	}
</script>

<style>
	.jiaobiao {
		position: absolute;
		height: 50upx;
		width: 100upx;
		right: 0;
		font-size: 100%;
		background-color: #00aa00;
		color: #FFFFFF;
		top: -3upx;
		border-radius: 10%;
		text-align: center;
	}

	.jiaobiao2 {
		position: absolute;
		height: 50upx;
		width: 100upx;
		right: 0;
		font-size: 100%;
		background-color: #ff0000;
		color: #FFFFFF;
		top: -3upx;
		border-radius: 10%;
		text-align: center;
	}
</style>
